<template>
  <header class="header">
    <div class="header-left">
      <span class="iconfont arrow-left">&#xe624;</span>
    </div>
    <div class="header-input">
      <span class="iconfont">&#xe632;</span>
      输入城市＼景点＼游玩主题
    </div>
    <router-link to="/city">
      <div class="header-right">
        {{this.city}} <!--通过 ...mapState 取得store里的数据 -->
        <span class="iconfont">&#xe64a;</span>
      </div>
    </router-link>
  </header>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: 'HomeHeader',
  computed: {
    ...mapState(['city'])
  }
}
</script>

<style lang="stylus" scoped>
@import '~styles/varibles.styl'
header {
  display: flex
  height: $headerHeight
  line-height: $headerHeight
  color: #fff
  background: $bgColor
  .header-left {
    width: .86rem
    float: left;
    .arrow-left {
      text-align: center
      display:block
      font-size: .4rem
    }
  }
  .header-input {
    flex: 1
    background: #fff
    border-radius: .1rem
    height: .64rem
    line-height: .64rem
    margin-top: .11rem
    color: #ccc
    padding-left: .1rem
  }
  .header-right {
    min-width: 1.04rem
    padding: 0 .1rem
    float: right
    text-align: center
    color: #fff
    span {
      font-size: .2rem
    }
  }
}
</style>
